pp108 : Generating Log Messages

Generating Log Messages

This topic presents an overview of generating log messages.


The process of creating and using log messages involves a series of steps right from defining the structure for them, to having an interface for using and routing them to appropriate consumers. Also, the log messages mechanism is capable of managing culture-specific descriptive text within the messages.The process of defining and using the log messages has been described below.

  1. Define log messages using a Message Repository which is an XML file and place the file in the <Process_Platform_Installation_Directory>\<localization folder>.
  2. Generate the corresponding message class using the Message Generator tool. See Generating Log Messages from Repository for more details.
  3. Use the generated to log LocalizableLogMessage. Here's an example:
    import com.eibus.util.logger.CordysLogger; import com.eibus.localization.message.internal.LogMessages; public class LocalizableLogMessageSample { static CordysLogger logger = CordysLogger.getCordysLogger(LocalizableLogMessageSample.class); /** * This Web service operation Logs the LocalizableLogMessage to CordysLogger. * */ public void loggerTest() { try { //some operation here logger.info(LogMessages.METHOD_INVOKED); } catch(Exception ex) { logger.error(ex,LogMessages.METHOD_INVOKE_ERROR); } }